if __name__ == '__main__':
    res = 0
    with open("22_name.txt", "r") as f:
        names = f.readline()
        names = names.replace('"', '')
        names = names.split(',')
    names = sorted(names)
    for i, name in enumerate(names):
        res += (i + 1) * (sum([ord(i) for i in name]) - 64 * len(name))
    print(res)

